package com.ashin.sdk;

import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;

import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;

public class OnePay {

    public static void main(String[] args) {
        // 初始化模板引擎
        VelocityEngine ve = new VelocityEngine();
        ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
        ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
        ve.init();
        // 获取模板文件
        Template t = ve.getTemplate("onepay.vm");
        // 设置变量
        VelocityContext ctx = new VelocityContext();
       /**
        *   user_id VARCHAR2(50):= '571BB9C9D5BB4042AD985C725C7FZYAT';
  --超级管理员的角色ID不改
    role_id VARCHAR2(50):= '1A1G5SBMS000088710AC0000D978735E';
    cust_id VARCHAR2(50):= '3A1G5SBMS000088710AC0000D97CFZYAT';
    cust_name VARCHAR2(50):='福州市永安堂大药房';
    user_name VARCHAR2(50):='永安堂大药房';
    login_id VARCHAR2(50):='fzyat';
    v_mobile VARCHAR2(50):='13600835001';       
    v_email VARCHAR2(50):='fzyat@ylzpay.com';
        */
        ctx.put("userId", "571BB9C9D5BB4042AD985C725C7FZYAT");
        ctx.put("roleId", "1A1G5SBMS000088710AC0000D978735E");
        ctx.put("custId", "3A1G5SBMS000088710AC0000D97CFZYAT");
        ctx.put("custName", "福州市永安堂大药房");
        ctx.put("userName", "永安堂大药房");
        ctx.put("loginId", "fzyat");
        ctx.put("vMobile", "13600835001");
        ctx.put("vEmail", "fzyat@ylzpay.com");
        
       
        // 输出
        StringWriter sw = new StringWriter();
        t.merge(ctx, sw);
        System.out.println(sw.toString());

    }

}
